package com.mhys.hms.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mhys.hms.entity.FeedBackObject;
import com.mhys.hms.entity.Train;
import com.mhys.hms.service.user.TrainManagerService;

@Controller
public class TrainManager {
	@Autowired
	private TrainManagerService trainManagerService;
		
	@RequestMapping(value="/queryTrain",method= {RequestMethod.POST, RequestMethod.GET})
	@ResponseBody
	public FeedBackObject queryTrainInfo() {
		//分页查询
		List<Train> list = trainManagerService.queryAllTrain();
		//封装数据
		Map<String, Object> map =new HashMap<String, Object>();
		FeedBackObject feedbackObject = new FeedBackObject();
		map.put("total", trainManagerService.queryAllTrain());
		map.put("data", list);
		feedbackObject.Obj = map;
		return feedbackObject;
	}
	
	/*
	 * @RequestMapping(value="{name}", method = RequestMethod.GET)
	 * public @ResponseBody FeedBackObject query(){ List<Train> list =
	 * trainManagerService.queryAllTrain(); //封装数据 Map<String, Object> map =new
	 * HashMap<String, Object>(); FeedBackObject feedbackObject = new
	 * FeedBackObject(); map.put("total", trainManagerService.queryAllTrain());
	 * map.put("data", list); feedbackObject.Obj = map; return feedbackObject; }
	 */
	
}









